/*
 *
 * This file is part of Aion SLX Emu.
 *
 * This is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser Public License for more details.
 *
 * You should have received a copy of the GNU Lesser Public License
 * along with this software.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Homepage : http://team-lx.net
 * Support Client Version : Aion 2.7 - (NA) 
 * Aion Emulator Version : Aion SLX 2.7
 */
 
package gameserver.model.instances;

import gameserver.world.WorldMap;
import gameserver.world.WorldMapInstance;

public class CrucibleChallenge extends WorldMapInstance
{
    private int stage = 0;
    private int round = 0;
    private int spawnedCount = 0;
    private int killedCount = 0;
    private boolean isStageAllSpawned = true;
    private boolean isRewarded = false;
    private int points = 0;
    private boolean isInReadyRoom = false;
    
    public CrucibleChallenge(WorldMap parent, int instanceId)
    {
        super(parent, instanceId);
    }
    
    public void addPoints(int addValue)
    {
        points += addValue;
    }
    
    public void putToReadyRoom()
    {
        isInReadyRoom = true;
    }
    
    public void removeFromReadyRoom()
    {
        isInReadyRoom = false;
    }
    
    public boolean isInReadyRoom()
    {
        return isInReadyRoom;
    }
    
    public int getArenaPoints()
    {
        return points;
    }
    
    public int getStage()
    {
        return stage;
    }
    
    public int getRound()
    {
        return round;
    }
    
    public void setStageAllSpawned(boolean isStageAllSpawned)
    {
        this.isStageAllSpawned = isStageAllSpawned;
    }
    
    public int getTotalSpawned()
    {
        return spawnedCount;
    }
    
    public int getTotalKilled()
    {
        return killedCount;
    }
    
    public boolean isStageAllSpawned()
    {
        return isStageAllSpawned;
    }
    
    public void addSpawnedCount(int count)
    {
        spawnedCount += count;
    }
    
    public void onReward()
    {
        killedCount += 1;
    }
    
    public void setRewarded(boolean value)
    {
        this.isRewarded = value;        
    }
    
    public boolean isRewarded()
    {
        return isRewarded;
    }
    
    public boolean isStageAllDead()
    {
        /*boolean isAllDead = true;
        for(Npc npc : getNpcs())
        {
            if((npc.getObjectTemplate().getNpcType() == NpcType.ATTACKABLE || npc.getObjectTemplate().getNpcType() == NpcType.AGGRESSIVE) && !npc.isInState(CreatureState.DEAD))
                isAllDead = false;
        }*/
        
        return killedCount >= spawnedCount;
    }
    
    public boolean isStageDone()
    {
        if(isStageAllSpawned() && isStageAllDead())
            return true;
        else
            return false;
    }
}
